package io.task.cc.message.socket;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicLong;


/**
 * @author huihui
 */
@Slf4j
@Setter
@Getter
public class Packet {
    public static int MAX_DATA_LENGTH = 132476;// 85732; // 65535 - 40;//51200  //179743  //197301  //197301  //85732
    private static final long serialVersionUID = 5275372187150637318L;
    private static final AtomicLong ID_ATOMICLONG = new AtomicLong();
    private Long id = ID_ATOMICLONG.incrementAndGet();
    /**
     * 本packet在解码时，消耗的字节数
     */
    private int byteCount = 0;


    private PacketMetaData packetMetaData = null;

    /**
     * 同步发送时，需要的同步序列号
     */
    private Integer synSeq = 0;
    /**
     * 预编码过的bytebuffer，如果此值不为null，框架则会忽略原来的encode()而直接用此值
     */
    private ByteBuffer preEncodedByteBuffer = null;


}
